Skip to content

Conversation

@SFARPak
Copy link
Owner

@SFARPak SFARPak commented Sep 14, 2025

Potential fix for https://github.com/SFARPak/ACode/security/code-scanning/12

To fix this problem, we need to ensure that all backslashes in the path are themselves escaped before escaping spaces. This is done by first replacing each single backslash (\) with a double backslash (\\). Then, replace each space ( ) with a backslash followed by a space (\ ). These two replacements must be performed sequentially in that order—first escape all backslashes, then escape spaces—so there's no ambiguity and the output is parseable.

Specifically, in the file webview-ui/src/utils/path-mentions.ts at line 12, update the escapeSpaces function to first perform .replace(/\\/g, "\\\\") and then .replace(/ /g, "\\ "). No new imports are needed.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@SFARPak SFARPak marked this pull request as ready for review September 14, 2025 15:59
@SFARPak SFARPak merged commit 0fb3006 into feature/extension-improvements Sep 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants